<template>
  <div>
    <el-table :data="tableData" border style="width: 100%" stripe>
      <el-table-column prop="stunum" label="学生" />
      <el-table-column prop="reason" label="选课理由" />
      <el-table-column prop="courseid" label="课程编号"/>
      <el-table-column prop="audit" label="审核" width="120px">
        <template #default="scope">
          <el-button type="text" @click="handleRequest(scope.row.id,true)">通过</el-button>
          <el-popconfirm title="确定拒绝此选课申请？" @confirm="handleRequest(scope.row.id,false)">
            <template #reference>
              <el-button type="danger">拒绝</el-button>
            </template>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "RollAudit",
  components:{
  },
  data(){
    return {
      form:{},
      tableData:[
        {
          student:1
        }
      ],
    }
  },
  created() {
    this.load()
  },
  methods:{
    load(){
      request.get("http://124.70.179.188:8082/selCourse/applyCourseList").then(res=>{
        this.tableData=res.data
        console.log(JSON.stringify(res))
      })
    },
    handleRequest(AuditId,allow){
      request.post("http://124.70.179.188:8082/selCourse/applicationMgt?id="+AuditId+"&b="+allow).then(res => {
        this.load()
      })
    },
  }
}
</script>

<style scoped>

</style>